<?php

class Golib_Plugin_ModuleLayout extends Zend_Controller_Plugin_Abstract 
{
        /**
         * preDispatch function.
         * 
         * Define the layout path based on what module is being used.
         *
         * @access public
         * @param Zend_Controller_Request_Abstract $request
         * @return void
         */
        public function preDispatch(Zend_Controller_Request_Abstract $request)
        {
                $layout = Zend_Layout::getMvcInstance();
                $module = strtolower($request->getModuleName());
                                
                if ($module=='admin')
                {
                        $layout->setLayoutPath(APPLICATION_PATH . '/admin/layouts/');
                        $layout->setLayout('layout');
                }else{
                    $layout->setLayoutPath(APPLICATION_PATH . '/layouts/scripts/');
                }
        }
}

?>
